home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 January, February, March & April
/
Chip-Cover-CD-2007-02.iso
/
Pakiet bezpieczenstwa
/
mini Pentoo LiveCD 2006.1
/
mpentoo-2006.1.iso
/
livecd.squashfs
/
usr
/
bin
/
mk_cmds
< prev
next >
Wrap
Text File
|
2005-10-13
|
949b
|
50 lines
#!/bin/sh
#
#
export LC_ALL=C
DIR="${DIR-/usr/share/ss}"
SS_DIR="/var/tmp/portage/ss-1.38/work/e2fsprogs-1.38/lib/ss"
AWK=gawk
SED=/bin/sed
if test "x$1" = x ; then
echo "Usage: mk_cmds file"
exit 1
fi
if test -n "$_SS_DIR_OVERRIDE" ; then
DIR="$_SS_DIR_OVERRIDE";
fi
if test ! -f $DIR/ct_c.sed || test ! -f $DIR/ct_c.awk ; then
DIR="$SS_DIR"
# echo "Falling back to $DIR..."
if test ! -f "$DIR/ct_c.sed" || test ! -f "$DIR/ct_c.awk" ; then
echo "mk_cmds: Couldn't find mk_cmds's template files."
exit 1
fi
fi
FILE="$1"
ROOT=`echo $1 | sed -e s/.ct$//`
BASE=`basename "$ROOT"`
TMP="ct$$.c"
if test ! -f "$FILE" ; then
echo "$FILE: File not found"
exit 1;
fi
${SED} -f "${DIR}/ct_c.sed" "${FILE}" \
| ${AWK} -f "${DIR}/ct_c.awk" "rootname=${ROOT}" "outfile=${TMP}" -
if grep "^#__ERROR_IN_FILE" "${TMP}" > /dev/null; then
rm "${TMP}"
exit 1
else
rm -f "${BASE}.c"
mv "${TMP}" "${BASE}.c"
exit 0
fi